package com.zhl.media.app.mvp.ui.activity;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.jess.arms.di.component.AppComponent;
import com.zhl.media.app.R;
import com.zhl.media.commonres.base.AppActivity;
import com.zhl.media.commonres.view.BaseItemView;
import com.zhl.media.commonres.view.PublicTitleBar;
import com.zhl.media.commonsdk.core.RouterHub;
import com.zhl.media.commonsdk.utils.GlideCacheUtil;
import com.zhl.media.commonsdk.utils.VersionUtils;
import butterknife.BindView;

@Route(path = RouterHub.APP_SETINGACTIVITY)
public class SetingActivity extends AppActivity {

    @BindView(R.id.titleBar)
    PublicTitleBar titleBar;

    @BindView(R.id.version)
    BaseItemView version;

    @BindView(R.id.clear_cache)
    BaseItemView cache;
    private String versionName;


    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {

    }
    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_seting;
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        titleBar.setTitle("设置");
        versionName = VersionUtils.getVersionName(this);
        version.setRightText(versionName);
        cache.setRightText(GlideCacheUtil.getInstance().getCacheSize(this));
        version.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });
        cache.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GlideCacheUtil.getInstance().clearImageAllCache(SetingActivity.this);
            }
        });
    }

}
